package lab2.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }


    @Bean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
    SimpleApplicationEventMulticaster customApplicationEventMulticaster(ThreadPoolTaskExecutor taskExcutor){
        SimpleApplicationEventMulticaster eventMulticaster=new SimpleApplicationEventMulticaster();
        eventMulticaster.setTaskExecutor(taskExcutor);
        return eventMulticaster;

    }
}
